package com.vf.admin.client.dao;

import com.vf.admin.common.db.BaseDao;
import com.vf.admin.miaodong.entity.AppGzUser;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;

/**
 * <p>Title : </p>
 * <p>Description : </p>
 * <p>DevelopTools : IDEA</p>
 * <p>DevelopSystem : Windows11</p>
 *
 * @Author : zxw
 * @Date 2023/9/6 11:41
 */
@Repository
public class AppGzUserDao extends BaseDao<AppGzUser> {


    public void save(AppGzUser appGzUser) {
        if (appGzUser.getId() != null && appGzUser.getId() > 0) {
            this.update(appGzUser);
        } else {
            appGzUser.setId(this.add(appGzUser));
        }
    }

    public AppGzUser isGouMai(Integer userIdToken, Integer userId) {
        ArrayList<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder("select * from app_gz_user where 1=1");
        sbStr.append("  and userId = ? ");
        paramList.add(userIdToken);
        sbStr.append("  and gzUserId = ? ");
        paramList.add(userId);
        String sql = sbStr.toString();
        return this.queryObj(sql,paramList,AppGzUser.class);

    }
}
